/**
 * 
 */
package com.gragra.sampling.binary;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.ArrayList;
import com.gragra.benchmark.CreateCorpusAndGoldAssigner;
import com.gragra.benchmark.FractionAblePopulationStructure;
import com.gragra.sampling.PopulationProbabilityAssigner;
/**
 * @author Christoph Teichmann
 * 21.09.2013
 */
public class CreateBinaryAndFixedConst implements CreateCorpusAndGoldAssigner
{
	/**
	 * 
	 */
	private final GeneratorForBinaryCorpus gbc;
	/**
	 * @param gbc
	 */
	public CreateBinaryAndFixedConst(GeneratorForBinaryCorpus gbc)
	{
		super();
		this.gbc = gbc;
	}
	/* (non-Javadoc)
	 * @see com.gragra.benchmark.CreateCorpusAndGoldAssigner#makeCorpusAndAssigner(java.io.BufferedReader, java.io.BufferedReader, int, double, double, int)
	 */
	@Override
	public void makeCorpusAndAssigner(BufferedReader br, BufferedReader brGold,
			int threads, double smoothing, double weight, int depth) throws IOException
	{
		struct = gbc.makeBinaryStructure(br.readLine(), threads, smoothing);
		ArrayList<String> l = new ArrayList<String>();
		l.add(brGold.readLine());
		l.add(brGold.readLine());
		ca = new FixedConstAssigner(threads, l, weight, depth);
	}
	/**
	 * 
	 */
	private PopulationProbabilityAssigner ca;
	/**
	 * 
	 */
	private FractionAblePopulationStructure struct;
	/* (non-Javadoc)
	 * @see com.gragra.benchmark.CreateCorpusAndGoldAssigner#getAssigner()
	 */
	@Override
	public PopulationProbabilityAssigner getAssigner()
	{return ca;}
	/* (non-Javadoc)
	 * @see com.gragra.benchmark.CreateCorpusAndGoldAssigner#getStructure(int)
	 */
	@Override
	public FractionAblePopulationStructure getStructure(int position)
	{return struct;}
}